package com.huang.springcloud.controller;

import com.huang.springcloud.pojo.Dept;
import com.huang.springcloud.service.DeptClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class DeptController {

    @Autowired
    DeptClient deptClient;

    @PostMapping("/consumer/dept/add")
    public int addDept(@RequestBody Dept dept) {
        return deptClient.addDept(dept);
    }

    @GetMapping("/consumer/dept/{id}")
    public Dept getById(@PathVariable("id") int id) {
        return deptClient.getById(id);
    }

    @GetMapping("/consumer/dept/list")
    public List<Dept> getList() {
        return deptClient.getList();
    }
}
